const express = require('express')
const app = express()

app.listen(80, () => {
  console.log('CMS-Server is running...')
})

// 解决ajax跨域请求问题  ---- 跨域资源共享
const cors = require('cors')
app.use(cors())

// 统一处理静态资源
app.use(express.static('./static'))

// 处理 post 请求携带的参数
const bp = require('body-parser')
app.use(bp.urlencoded({extended: false}))

// 加载路由模块
const loginRouter = require('./router/Login.router')
app.use('/school/api/v1.0', loginRouter)

const studentRouter = require('./router/Student.router')
app.use('/school/api/v1.0', studentRouter)

const otherRouter = require('./router/Other.router')
app.use('/school/api/v1.0', otherRouter)

const testRouter = require('./router/Test.router')
app.use(testRouter)

